#include "Camera.h"

using namespace Graphics;

//Declare the Camera as a dynamic renderable
Camera::Camera(const Point& position, const Point& lookAt, Renderable* parent):Renderable(parent,true),_lookAt(lookAt)
{
	_position=position;
}

void Camera::update()
{
	glLoadIdentity();
	gluLookAt(	_position.x(),
				_position.y(),
				_position.z(), 
				
				_lookAt.x(),
				_lookAt.y(),
				_lookAt.z(),
				
				//Y axis (could have used Vector::Y, but this is faster
				0.0f,1.0f,0.0f);

	glutPostRedisplay();
}

void Camera::strafe(const Vector& where)
{
	_position+=where;
	_lookAt+=where;
}
